package com.lin.missyou.model;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/**
 * @author gcq
 * @Create 2021-11-02
 */
@Entity
@Setter
@Getter
@Where(clause = "delete_time is null")
public class Coupon extends BaseEntity {

    @Id
    private Long id;
    private String title;
    private Date startTime;
    private Date endTime;
    private String description;
    /**
     * 总金额
     */
    private BigDecimal fullMoney;
    /**
     * 优惠卷减去金额
     */
    private BigDecimal minus;
    private BigDecimal rate;
    private short type;
    private Long activityId;
    private String remark;
    /**
     * 所有价格
     */
    private Boolean wholeStore;

    /**
     * 多对多
     * 优惠卷和分类
     */
    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "couponList")
    private List<Category> categoryList;
}